using System;
using System.Collections.Generic;
using System.Text;

namespace GetTogether.Studio.Web.Common
{
    public class Util
    {
        public static void Compress(string sourceFolder, string outFile)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.FileName = GetTogether.Studio.Config.Original.CompressFileName;
            p.StartInfo.Arguments = string.Concat(@"a -t7z -mx9 ", outFile, " -w ", sourceFolder);
            p.Start();
            string log = p.StandardOutput.ReadToEnd();
            p.WaitForExit();
            string logFile = string.Concat(outFile, ".txt");
            System.IO.File.WriteAllText(logFile, log);
        }
    }
}
